<h1>Editing app</h1>
<%= link_to 'Show', [:cms,@app] %> |
<%= link_to 'Back', cms_apps_path %>
<% form_for([:cms,@app]) do |f| %>   
<p>
  <%= f.submit 'Update' %>
</p>
  <%= f.error_messages %>

  <p>
    <%= f.label :name %><br />
    <%= f.text_field :name %>
  </p>
  <p>
    <%= f.label :class_name %><br />
    <%= f.text_field :class_name %>
  </p>

<hr>
<p>
	<%= f.label :show_block, "Show Block" %> <br/>
	<%= f.text_area :show_block ,:rows => 8, :cols => 60%>                                                                                                                          
</p>                                                                                                                                                        
<p>
	<% if !@app.trs.visibles.blank? %>
	  <% for item in @app.trs.visibles %>
	    <%= button_to_function item.name , "textboxReplaceSelect($('#app_show_block')[0],'&lt;%=show.#{item.name}%&gt;')" %>
	  <% end %>
	<% else %>
	    请先在应用中添加动态内容。
	<% end %>
	
</p> 
<p>
	<%= f.label :list_block, "List Block" %> <br/>
	<%= f.text_area :list_block ,:rows => 8, :cols => 60%>                                                                                                                          
</p>
<p>
	<% if !@app.trs.visibles.blank? %>
	  <% for item in @app.trs.visibles %>
	    <%= button_to_function item.name , "textboxReplaceSelect($('#app_list_block')[0],'&lt;%=list.#{item.name}%&gt;')" %>
	  <% end %>
	<% else %>
	    请先在应用中添加动态内容。
	<% end %>
	
</p> 
<p>
	<%= f.label :edit_block, "Edit Block" %>  貌似这个不需要<br/>
	<%= f.text_area :edit_block ,:rows => 8, :cols => 60%>                                                                                                                          
</p>
<p>
	<% if !@app.trs.visibles.blank? %>
	  <% for item in @app.trs.visibles %>
	    <%= button_to_function item.name , "textboxReplaceSelect($('#app_list_block')[0],'&lt;%=list.#{item.name}%&gt;')" %>
	  <% end %>
	<% else %>
	    请先在应用中添加动态内容。
	<% end %>
	
</p>
<p>
  <%= f.submit 'Update' %>
</p>
<% end %>


<hr>
   
<script type="text/javascript">
function textboxReplaceSelect (oTextbox, sText) {
if (false) {
var oRange = document.selection.createRange();
oRange.text = sText;
oRange.collapse(true);
oRange.select();
} else if (true) {
var iStart = oTextbox.selectionStart;
oTextbox.value = oTextbox.value.substring(0, iStart) + sText + oTextbox.value.substring(oTextbox.selectionEnd, oTextbox.value.length);
oTextbox.setSelectionRange(iStart + sText.length, iStart + sText.length);
}
oTextbox.focus();
}             
</script>
